home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MacGames Sampler
/
PHT MacGames Bundle.iso
/
MacSource Folder
/
Samples from the CD
/
Modula
/
Modula-2 shell
< prev
Wrap
Text File
|
1986-05-21
|
27KB
|
814 lines
/* Written 4:43 pm May 8, 1986 by bobc@tikal.UUCP in uiucdcsb:net.sources.mac */
/* ---------- "ETHZ Standalone Definition Modules" ---------- */
# The rest of this file is a shell script which will extract:
# ResourceManager.DEF SFPackage.DEF SYSTEMX.DEF ScrapManager.DEF
# Storage.DEF Streams.DEF Terminal.DEF TextEdit.DEF Toolbox.DEF
# WindowManager.DEF
echo x - ResourceManager.DEF
cat >ResourceManager.DEF <<'!Funky!Stuff!'
DEFINITION MODULE ResourceManager;
FROM SYSTEM IMPORT ADDRESS;
FROM MacSYSTEM IMPORT LONGINT,Handle;
EXPORT QUALIFIED
(*CONST*)
(* Resource attributes *)
resSysRef,resSysHeap,resPurgeable,resLocked,resProtected,
resPreload,resChanged,
(* Resource Manager Result codes *)
resNotFound,resFNotFound,addResFailed,addRefFailed,rmvResFailed,
rmvRefFailed,
(* Resource file attributes *)
mapReadOnly,mapCompact,mapChanged,
(*TYPE*)
ResType,ParamResType,
(*VAR*)
CurMap,CurApRefNum,SysMap,SysResName,SysMapHndl,TopMapHndl,ResLoad,
ResErr,
(*PROC*)
CreateResFile,OpenResFile,CloseResFile,
ResError,
CurResFile,HomeResFile,UseResFile,
CountTypes,GetIndType,
SetResLoad,CountResources,GetIndResource,GetResource,
GetNamedResource,LoadResource,ReleaseResource,DetachResource,
UniqueID,GetResInfo,GetResAttrs,SizeResource,
SetResInfo,SetResAttrs,ChangedResource,AddResource,
RmveResource,UpdateResFile,WriteResource,SetResPurge,
GetResFileAttrs,SetResFileAttrs;
CONST
(* Resource attributes *)
resSysRef = 128; (* set if system reference *)
resSysHeap = 64; (* set if read into system heap *)
resPurgeable = 32; (* set if purgeable *)
resLocked = 16; (* set if locked *)
resProtected = 8; (* set if protected *)
resPreload = 4; (* set if to be preloaded *)
resChanged = 2; (* set if to be written to res file *)
(* Resource Manager Result codes *)
resNotFound = -192; (* resource not found *)
resFNotFound = -193; (* resource file not found *)
addResFailed = -194; (* AddResource failed *)
addRefFailed = -195; (* AddReference failed *)
rmvResFailed = -196; (* RmveResource failed *)
rmvRefFailed = -197; (* RmveReference failed *)
(* Resource file attributes *)
mapReadOnly = 128; (* set if file is read-only *)
mapCompact = 64; (* set to compact file on update*)
mapChanged = 32; (* set to write map on update *)
TYPE
ResType = ARRAY [0..3] OF CHAR;
ParamResType = RECORD
CASE INTEGER OF
0:
res:ResType
| 1:
param:LONGINT
END
END;
VAR
TopMapHndl[0A50H]: Handle;
SysMapHndl[0A54H]: Handle;
SysMap[0A58H]: CARDINAL;
CurMap[0A5AH]: CARDINAL;
ResLoad[0A5EH]: BOOLEAN;
ResErr[0A60H]: INTEGER;
CurApRefNum[0900H]: CARDINAL;
SysResName[0AD8H]: ARRAY [0..20] OF CHAR;
(* Opening and Closing Resource Files *)
PROCEDURE CreateResFile(VAR fileName:ARRAY OF CHAR);
PROCEDURE OpenResFile(VAR fileName:ARRAY OF CHAR):INTEGER;
PROCEDURE CloseResFile(refNum:INTEGER);
(* Checking for Errors *)
PROCEDURE ResError():INTEGER;
(* Setting the Current Resource File *)
PROCEDURE CurResFile():INTEGER;
PROCEDURE HomeResFile(theResource:Handle):INTEGER;
PROCEDURE UseResFile(refNum:INTEGER);
(* Getting Resource Types *)
PROCEDURE CountTypes():INTEGER;
PROCEDURE GetIndType(VAR theType:ResType;index:INTEGER);
(* Getting and Disposing of Resources *)
PROCEDURE SetResLoad(load:BOOLEAN);
PROCEDURE CountResources(theType:ResType):INTEGER;
PROCEDURE GetIndResource(theType:ResType;index:INTEGER):Handle;
PROCEDURE GetResource(theType:ResType;theID:INTEGER):Handle;
PROCEDURE GetNamedResource(theType:ResType;VAR name:ARRAY OF CHAR):Handle;
PROCEDURE LoadResource(theResource:Handle);
PROCEDURE ReleaseResource(theResource:Handle);
PROCEDURE DetachResource(theResource:Handle);
(* Getting Resource Information *)
PROCEDURE UniqueID(theType:ResType):INTEGER;
PROCEDURE GetResInfo(theResource:Handle;VAR theID:INTEGER;
VAR theType:ResType; VAR name:ARRAY OF CHAR);
PROCEDURE GetResAttrs(theResource:Handle):INTEGER;
PROCEDURE SizeResource(theResource:Handle):LONGINT;
(* Modifying Resources *)
PROCEDURE SetResInfo(theResource:Handle; theID:INTEGER;VAR name:ARRAY OF CHAR);
PROCEDURE SetResAttrs(theResource:Handle;attrs:INTEGER);
PROCEDURE ChangedResource(theResource:Handle);
PROCEDURE AddResource(theData:Handle;theType:ResType;theID:INTEGER;
VAR name:ARRAY OF CHAR);
PROCEDURE RmveResource(theResource:Handle);
PROCEDURE UpdateResFile(refNum:INTEGER);
PROCEDURE WriteResource(theResource:Handle);
PROCEDURE SetResPurge(install:BOOLEAN);
(* Advanced Routines *)
PROCEDURE GetResFileAttrs(refNum:INTEGER):INTEGER;
PROCEDURE SetResFileAttrs(refNum:INTEGER;attrs:INTEGER);
END ResourceManager.
!Funky!Stuff!
echo x - SFPackage.DEF
cat >SFPackage.DEF <<'!Funky!Stuff!'
DEFINITION MODULE SFPackage;
FROM SYSTEM IMPORT ADDRESS,WORD;
FROM QuickDraw IMPORT Point;
FROM FileTypes IMPORT OSType,ParamBlkPtr;
FROM DialogManager IMPORT DialogPtr;
EXPORT QUALIFIED putDlgID,getDlgID,SFReply,SFTypeList,
SFPutFile,SFPPutFile, SFGetFile,SFPGetFile,
putSave ,putCancel,putEject ,putDrive ,putName,
getOpen,getCancel,getEject,getDrive,getScroll,
getNmList,MyDlgType,MyFileFilterType,NoFileFilter,NoDlg,
UseDlg,UseFileFilter;
(* constants for Standard File package *)
CONST
putDlgID = -3999; (* SFPutFile dialog template ID} *)
getDlgID = -4000; (* SFGetFile dialog template ID} *)
putSave = 1; (* save button} *)
putCancel = 2; (* cancel button} *)
putEject = 5; (* eject button} *)
putDrive = 6; (* drive button} *)
putName = 7; (* editTExt item for file name} *)
getOpen = 1; (* open button} *)
getCancel = 3; (* cancel button} *)
getEject = 5; (* eject button} *)
getDrive = 6; (* drive button} *)
getNmList = 7; (* userItem for file name list} *)
getScroll = 8; (* userItem for scroll bar} *)
TYPE
SFReply = RECORD
good: BOOLEAN; (* ignore command if FALSE} *)
copy: BOOLEAN; (* not used} *)
fType: OSType; (* file type or not used} *)
vRefNum: INTEGER; (* volume reference number} *)
version: INTEGER; (* file's version number} *)
fName: ARRAY [0..63] OF CHAR
END; (* SFReply *)
SFTypeList = ARRAY[0..3] OF OSType;
MyDlgType = PROCEDURE(INTEGER,DialogPtr):INTEGER;
MyFileFilterType = PROCEDURE(ParamBlkPtr):BOOLEAN;
PROCEDURE NoDlg():ADDRESS;
PROCEDURE UseDlg(Dlg:MyDlgType):ADDRESS;
PROCEDURE NoFileFilter():ADDRESS;
PROCEDURE UseFileFilter(FileFilter:MyFileFilterType):ADDRESS;
PROCEDURE SFPutFile(lefttop:Point;
VAR prompt: ARRAY OF CHAR; VAR origName: ARRAY OF CHAR;
dlgHook: ADDRESS; VAR reply: SFReply);
PROCEDURE SFPPutFile(lefttop:Point;
VAR prompt: ARRAY OF CHAR; VAR origName: ARRAY OF CHAR;
dlgHook: ADDRESS; VAR reply: SFReply; dlgID: INTEGER;
filterProc: ADDRESS);
PROCEDURE SFGetFile(lefttop:Point;
VAR prompt: ARRAY OF CHAR; fileFilter: ADDRESS;
numTypes: INTEGER; VAR typeList: SFTypeList;
dlgHook: ADDRESS; VAR reply: SFReply);
PROCEDURE SFPGetFile(lefttop:Point;
VAR prompt: ARRAY OF CHAR; fileFilter: ADDRESS;
numTypes: INTEGER; VAR typeList: SFTypeList;
dlgHook: ADDRESS; VAR reply: SFReply;
dlgID: INTEGER; filterProc: ADDRESS);
END SFPackage.
!Funky!Stuff!
echo x - SYSTEMX.DEF
cat >SYSTEMX.DEF <<'!Funky!Stuff!'
DEFINITION MODULE SYSTEMX;
FROM SYSTEM IMPORT ADDRESS,PROCESS;
EXPORT QUALIFIED SaveA5,SaveA6,SaveA7,SaveA0,
DoCASE,DoHALT,CheckStack,NEWPROCESS,TRANSFER,IOTRANSFER,
SYSProc7,SYSLongMult,SYSLongDivMod,SYSLongIntMult,SYSProc11,
SYSRealAdd,SYSRealSub,SYSRealMult,SYSRealDiv,SYSRealCMP,
SYSRealTST,SYSRealFLOAT,SYSRealTRUNC;
VAR
SaveA5,SaveA7,SaveA6,SaveA0:ADDRESS;
PROCEDURE DoCASE; (* 1 *)
PROCEDURE DoHALT; (* 2 *)
PROCEDURE CheckStack; (* 3 *)
PROCEDURE NEWPROCESS; (* 4 *)
PROCEDURE TRANSFER; (* 5 *)
PROCEDURE IOTRANSFER(p1,p2:PROCESS; via:ADDRESS); (* 6 *)
PROCEDURE SYSProc7; (* 7 *)
(* IF D0 = 2 THEN LISTEN ELSIF D0 = 3 THEN SYSRESET END *)
PROCEDURE SYSLongMult; (* 8 *)
PROCEDURE SYSLongDivMod; (* 9 *)
PROCEDURE SYSLongIntMult; (* 10 *)
PROCEDURE SYSProc11; (* 11 *)
PROCEDURE SYSRealAdd; (* 12 *)
PROCEDURE SYSRealSub; (* 13 *)
PROCEDURE SYSRealMult; (* 14 *)
PROCEDURE SYSRealDiv; (* 15 *)
PROCEDURE SYSRealCMP; (* 16 *)
PROCEDURE SYSRealTST; (* 17 *)
PROCEDURE SYSRealFLOAT; (* 18 *)
PROCEDURE SYSRealTRUNC; (* 19 *)
END SYSTEMX.
!Funky!Stuff!
echo x - ScrapManager.DEF
cat >ScrapManager.DEF <<'!Funky!Stuff!'
DEFINITION MODULE ScrapManager;
FROM MacSYSTEM IMPORT LONGINT,Handle,StringPtr;
FROM ResourceManager IMPORT ResType;
FROM SYSTEM IMPORT ADDRESS;
EXPORT QUALIFIED noScrapErr,noTypeErr,PScrapStuff,ScrapStuff,
InfoScrap,UnloadScrap,LoadScrap,ZeroScrap,PutScrap,GetScrap,
ScrapSize,ScrapHandle,ScrapCount,ScrapState,ScrapName;
CONST
noScrapErr = -100; (* desk scrap isn't initialized *)
noTypeErr = -102; (* no data of the requested type *)
TYPE
PScrapStuff = POINTER TO ScrapStuff;
ScrapStuff = RECORD
scrapSize: LONGINT; (* size of desk scrap *)
scrapHandle: Handle; (* handle to desk scrap *)
scrapCount: INTEGER; (* count changed by ZeroScrap *)
scrapState: INTEGER; (* tells where desk scrap is *)
scrapName: StringPtr; (* scrap file name *)
END;
VAR
ScrapSize[0960H]: LONGINT;
ScrapHandle[0964H]: Handle;
ScrapCount[0968H]: INTEGER;
ScrapState[096AH]: INTEGER;
ScrapName[096CH]: StringPtr;
PROCEDURE InfoScrap():PScrapStuff;
PROCEDURE UnloadScrap():LONGINT;
PROCEDURE LoadScrap():LONGINT;
PROCEDURE ZeroScrap():LONGINT;
PROCEDURE PutScrap(length: LONGINT; theType: ResType; source: ADDRESS):LONGINT;
PROCEDURE GetScrap(hDest:Handle;theType: ResType; VAR offset: LONGINT):LONGINT;
END ScrapManager.
!Funky!Stuff!
echo x - Storage.DEF
cat >Storage.DEF <<'!Funky!Stuff!'
DEFINITION MODULE Storage;
(* to be used unchanged for MacIntosh by Franz Kronseder 30.01.85 *)
(* Modified for standalone MacIntosh Code By Bob Campbell 10.02.86
* The Implementation now used the A-Line calls to the memory manager
* All of the storage allocated is set to zero. The Calls CreateHeap,
* and DestroyHeap have been removed.
*)
FROM SYSTEM IMPORT ADDRESS;
EXPORT QUALIFIED
ALLOCATE, DEALLOCATE, Available;
PROCEDURE ALLOCATE (VAR addr : ADDRESS; amount : CARDINAL);
(* allocates the requested amount of memory (in bytes) and returns the *)
(* starting address . Return NIL if the amount is not available *)
PROCEDURE DEALLOCATE (VAR addr : ADDRESS; amount : CARDINAL);
(* deallocates the given amount of memory (in bytes). *)
PROCEDURE Available (amount : CARDINAL) : BOOLEAN;
(* returns TRUE if an ALLOCATE of the specified amount (in bytes) *)
(* of memory would be possible *)
END Storage.
!Funky!Stuff!
echo x - Streams.DEF
cat >Streams.DEF <<'!Funky!Stuff!'
DEFINITION MODULE Streams;
(*
* Modified from the book "PROGRAMMING IN
* MODULA-2" by Miklaus Wirth Edited by
* David Gries pages 103 and 104.
*)
FROM SYSTEM IMPORT WORD,ADDRESS;
FROM MacSYSTEM IMPORT LONGINT;
FROM FileTypes IMPORT ParamBlkRec,OSType;
EXPORT QUALIFIED
STREAM,OpenMode,Open,Close,Create,
WriteWord,WriteChar,WriteBuffer,
ReadWord,ReadChar,ReadBuffer,
EOS,Reset,SetPos,GetPos,eolc;
CONST
eolc = 15C;
TYPE
STREAM = POINTER TO StreamRec;
StreamRec = RECORD
IsOpen : BOOLEAN;
Buffer : ADDRESS;
FileNum : INTEGER;
EOSPos : LONGINT;
CurrentPos : LONGINT;
PB : ParamBlkRec;
END;
OpenMode = (ReadOnly,WriteOnly,ReadWrite);
OSType = ARRAY [0..3] OF CHAR;
PROCEDURE Open(VAR file:STREAM; VAR Name:ARRAY OF CHAR;vref:INTEGER;
Mode:OpenMode);
PROCEDURE Create(VAR Name:ARRAY OF CHAR;vRef:INTEGER;
creator,type:OSType);
PROCEDURE Close(s:STREAM);
PROCEDURE WriteWord(s:STREAM;w:WORD);
PROCEDURE WriteChar(s:STREAM;c:CHAR);
PROCEDURE WriteBuffer(s:STREAM;b:ADDRESS;len:LONGINT):LONGINT;
PROCEDURE ReadWord(s:STREAM;VAR w:WORD);
PROCEDURE ReadChar(s:STREAM;VAR c:CHAR);
PROCEDURE ReadBuffer(s:STREAM;b:ADDRESS;len:LONGINT):LONGINT;
PROCEDURE EOS(s:STREAM):BOOLEAN;
PROCEDURE Reset(s:STREAM);
PROCEDURE SetPos(s:STREAM;pos:LONGINT);
PROCEDURE GetPos(s:STREAM;VAR pos:LONGINT);
END Streams.
!Funky!Stuff!
echo x - Terminal.DEF
cat >Terminal.DEF <<'!Funky!Stuff!'
DEFINITION MODULE Terminal;
(* A.Wespisser, 20-NOV-84
*---------------------------
* J.Wyttenbach, 11-jan-85
* B.Campbell, 10-FEB-86
*
* NOTE: - The procedures "KeyPress" and "GotoXY" and "ClearTerminal" are
* not contained in module "Terminal" on SMAKY8.
* - "BusyRead", "ReadString", "KeyPress" and "GotoXY" and
* "ClearTerminal" are not required by the compiler itself.
*)
EXPORT QUALIFIED Write, WriteString, WriteLn, Read, ReadString, ReadLn,
BusyRead, ReadAgain,KeyPress, GotoXY, ClearTerminal;
PROCEDURE Write (ch: CHAR);
PROCEDURE WriteString(VAR s:ARRAY OF CHAR);
PROCEDURE WriteLn; (*terminate line*)
PROCEDURE Read(VAR ch:CHAR);
PROCEDURE ReadString(VAR s:ARRAY OF CHAR);
PROCEDURE ReadLn (VAR s:ARRAY OF CHAR);
PROCEDURE BusyRead(VAR ch:CHAR);
PROCEDURE ReadAgain;
(* causes the last character read to be returned again
* upon the next call of Read
*)
PROCEDURE KeyPress():BOOLEAN;
PROCEDURE GotoXY(x,y:CARDINAL); (* Move to column x, row y *)
PROCEDURE ClearTerminal;
END Terminal.
!Funky!Stuff!
echo x - TextEdit.DEF
cat >TextEdit.DEF <<'!Funky!Stuff!'
DEFINITION MODULE TextEdit;
FROM SYSTEM IMPORT ADDRESS;
FROM MacSYSTEM IMPORT Handle,LONGINT,OSErr;
FROM QuickDraw IMPORT Style,Rect,Point,GrafPtr;
EXPORT QUALIFIED
teJustLeft,teJustCenter,teJustRight,
CharsHandle,CharsPtr,Chars,TEHandle,TEPtr,
TERec,
DoubleTime,CaretTime,TEScrpHandle,TEScrpLength,
TENew,TEDispose,TESetText,TEGetText,
TEIdle,TEClick,TESetSelect,TEActivate,TEDeactivate,
TEKey,TECut,TECopy,TEPaste,TEDelete,TEInsert,
TESetJust,TEUpdate,TextBox,TEScroll,
TEFromScrap,TEToScrap,TEScrapHandle,TEGetScrapLen,TESetScrapLen,
SetWordBreak,SetClikLoop,TECalText;
CONST
teJustLeft = 0;
teJustCenter = 1;
teJustRight = -1;
TYPE
Chars = ARRAY [0..32000] OF CHAR;
CharsPtr = POINTER TO Chars;
CharsHandle = POINTER TO CharsPtr;
TERec = RECORD
destRect: Rect;
viewRect: Rect;
selRect: Rect; (* used from assembly *)
lineHeight: INTEGER;
fontAscent: INTEGER;
selPoint: Point;
selStart: INTEGER;
selEnd: INTEGER;
active: INTEGER;
wordBreak: ADDRESS; (* ADDRESS of wordBreak Routine*)
clikLoop: ADDRESS; (* ADDRESS of clikLoop Routine *)
clickTime: LONGINT;
clickLoc: INTEGER;
caretTime: LONGINT;
caretState: INTEGER;
just: INTEGER;
teLength: INTEGER;
hText: Handle;
recalBack: INTEGER;
recalLines: INTEGER;
clikStuff: INTEGER;
crOnly: INTEGER;
txFont: INTEGER;
txFace: Style;
txMode: INTEGER;
txSize: INTEGER;
inPort: GrafPtr;
highHook: ADDRESS;
caretHook: ADDRESS;
nLines: INTEGER;
lineStarts: ARRAY [0..16000] OF INTEGER;
END;
TEPtr = POINTER TO TERec;
TEHandle = POINTER TO TEPtr;
VAR
DoubleTime[02F0H]: LONGINT;
CaretTime[02F4H]: LONGINT;
TEScrpHandle[0AB4H]: Handle;
TEScrpLength[0AB0H]: LONGINT;
PROCEDURE TENew(VAR destRect,viewRect:Rect):TEHandle;
(* VAR is for Modula is really by value *)
PROCEDURE TEDispose(hTE:TEHandle);
(* Accessing the Text of an Edit Record *)
PROCEDURE TESetText (text:ADDRESS;length:LONGINT;hTE:TEHandle);
PROCEDURE TEGetText (hTE: TEHandle):CharsHandle;
(*Insertion Point and Selection Range*)
PROCEDURE TEIdle (hTE:TEHandle);
PROCEDURE TEClick (pt:Point;extend:BOOLEAN;hTE:TEHandle);
PROCEDURE TESetSelect (selStart,selEnd: LONGINT; hTE:TEHandle);
PROCEDURE TEActivate (hTE: TEHandle);
PROCEDURE TEDeactivate (hTE:TEHandle);
(* Editing *)
PROCEDURE TEKey (key:CHAR;hTE:TEHandle);
PROCEDURE TECut (hTE:TEHandle);
PROCEDURE TECopy (hTE:TEHandle);
PROCEDURE TEPaste (hTE:TEHandle);
PROCEDURE TEDelete (hTE: TEHandle);
PROCEDURE TEInsert (text:ADDRESS;length:LONGINT;hTE:TEHandle);
(* Text Display and Scrolling *)
PROCEDURE TESetJust (just:INTEGER;hTE:TEHandle);
PROCEDURE TEUpdate (VAR rUpdate: Rect; hTE:TEHandle);
PROCEDURE TextBox (text:ADDRESS;
length:LONGINT;
VAR box:Rect;
just:INTEGER);
PROCEDURE TEScroll (dh,dv:INTEGER;hTE:TEHandle);
(* Scrap Handling *)
PROCEDURE TEFromScrap():OSErr;
PROCEDURE TEToScrap():OSErr;
PROCEDURE TEScrapHandle():Handle;
PROCEDURE TEGetScrapLen():LONGINT;
PROCEDURE TESetScrapLen(length:LONGINT);
(* Advanced Routine *)
PROCEDURE SetWordBreak(wBrkProc:ADDRESS; hTE: TEHandle);
PROCEDURE SetClikLoop(clickProc:ADDRESS; hTE: TEHandle);
PROCEDURE TECalText (hTE:TEHandle);
END TextEdit.
!Funky!Stuff!
echo x - Toolbox.DEF
cat >Toolbox.DEF <<'!Funky!Stuff!'
DEFINITION MODULE Toolbox;
(* Cursor routines and constants moved to Cursors *)
(* GetPic moved to Pictures *)
FROM SYSTEM IMPORT ADDRESS;
FROM MacSYSTEM IMPORT LONGINT,Handle,Fixed,Int64Bit,StringHandle;
FROM QuickDraw IMPORT Pattern,Str255,Point,Rect;
EXPORT QUALIFIED
(*CONST*)
sysPatListID,PatPtr,PatHandle,
(*VAR*)
ScrVRes,ScrHRes,
(*math*)
FixRatio,FixMul,FixRound,
(*strings*)
NewString,SetString,GetString,GetIndString,
(*byte manipulation*)
Munger,PackBits,UnpackBits,
(*bit Manipulation*)
BitTst,BitSet,BitClr,
(*Logical Operations*)
BitAnd,BitOr,BitXor,BitNot,BitShift,
(*Other Operations on Long Integers*)
HiWord,LoWord,LongMul,
(* Graphics Utilities *)
ScreenRes,GetIcon,PlotIcon,GetPattern,GetIndPattern,
(* Miscellaneous Utilities *)
Random,StuffHex,DeltaPoint,SlopeFromAngle,AngleFromSlope;
CONST
sysPatListID = 0;
TYPE
PatPtr = POINTER TO Pattern;
PatHandle = POINTER TO PatPtr;
VAR
ScrHRes[0104H]:INTEGER;
ScrVRes[0102H]:INTEGER;
PROCEDURE FixRatio(numer,denom:INTEGER):Fixed;
PROCEDURE FixMul(a,b:Fixed):Fixed;
PROCEDURE FixRound(x:Fixed):INTEGER;
(*String*)
PROCEDURE NewString(VAR theString:ARRAY OF CHAR):StringHandle;
PROCEDURE SetString(h:StringHandle;VAR theString:ARRAY OF CHAR);
PROCEDURE GetString(StringID:INTEGER):StringHandle;
PROCEDURE GetIndString(VAR theString:ARRAY OF CHAR;strListID:INTEGER;
index:INTEGER); (* no trap macro *)
(*byte manipulation*)
PROCEDURE Munger(h:Handle;offset:LONGINT;ptrl:ADDRESS;len1:LONGINT;
ptr2:ADDRESS;len2:LONGINT):LONGINT;
PROCEDURE PackBits(VAR srcPtr,dstPtr:ADDRESS; srcBytes:INTEGER);
PROCEDURE UnpackBits(VAR srcPtr,dstPtr:ADDRESS; dstBytes:INTEGER);
(*bit Manipulation*)
PROCEDURE BitTst(bytePtr:ADDRESS;bitNum:LONGINT):BOOLEAN;
PROCEDURE BitSet(bytePtr:ADDRESS;bitNum:LONGINT);
PROCEDURE BitClr(bytePtr:ADDRESS;bitNum:LONGINT);
(*Logical Operations*)
PROCEDURE BitAnd(val1,val2:LONGINT):LONGINT;
PROCEDURE BitOr (val1,val2:LONGINT):LONGINT;
PROCEDURE BitXor(val1,val2:LONGINT):LONGINT;
PROCEDURE BitNot(val:LONGINT):LONGINT;
PROCEDURE BitShift(value:LONGINT;count:INTEGER):LONGINT;
(*Other Operations on Long Integers*)
PROCEDURE HiWord(x:LONGINT):INTEGER;
PROCEDURE LoWord(x:LONGINT):INTEGER;
PROCEDURE LongMul(a,b:LONGINT;VAR dest:Int64Bit);
(* Graphics Utilities *)
PROCEDURE ScreenRes(VAR scrnHRes,scrnVRes:INTEGER);
PROCEDURE GetIcon(iconID:INTEGER):Handle;
PROCEDURE PlotIcon(theRect:Rect;theIcon:Handle);
PROCEDURE GetPattern(patID:INTEGER):PatHandle;
PROCEDURE GetIndPattern(VAR thePattern:Pattern;patListID:INTEGER;
index:INTEGER); (* no trap macro *)
(* ShieldCursor Left here because of cyclic input *)
(* Miscellaneous Utilities *)
PROCEDURE Random ():INTEGER;
PROCEDURE StuffHex (thingPtr:ADDRESS;VAR s:ARRAY OF CHAR);
PROCEDURE DeltaPoint(ptA,ptB:Point):LONGINT;
PROCEDURE SlopeFromAngle(angle:INTEGER):Fixed;
PROCEDURE AngleFromSlope(slope:Fixed):INTEGER;
END Toolbox.
!Funky!Stuff!
echo x - WindowManager.DEF
cat >WindowManager.DEF <<'!Funky!Stuff!'
DEFINITION MODULE WindowManager;
FROM SYSTEM IMPORT ADDRESS,WORD;
FROM MacSYSTEM IMPORT LONGINT,Handle,StringHandle;
FROM QuickDraw IMPORT GrafPort,GrafPtr,Point,VHSelect,Rect,RgnHandle;
FROM Pictures IMPORT PicHandle;
FROM EventManager IMPORT EventRecord;
EXPORT QUALIFIED
(*CONST*)
(* Window definition procedure IDs *)
documentProc,dBoxProc,plainDBox,altDBoxProc,noGrowDocProc,
rDocProc,
(* Types of Windows *)
dialogKind,userKind,
(* FindWindow result codes *)
inDesk,inMenuBar,inSysWindow,inContent,inDrag,inGrow,inGoAway,
(* Axis constraints for DragGrayRgn call *)
noConstraint,hAxsOnly,vAxsOnly,
(* Window Messages *)
wDraw,wHit,wCalcRgns,wNew,wDispose,wGrow,wDrawGIcon,
(* ... hit test codes *)
wNoHit,wInContent,wInDrag,wInGrow,wInGoAway,
deskPatID,
(*TYPE*)
WindowPtr,WindowPeek,WindowRecord,
(*PROCS*)
NewWindow,GetNewWindow,CloseWindow,DisposeWindow,
SetWTitle,GetWTitle,SetWRefCon,GetWRefCon,
HideWindow,ShowWindow,ShowHide,
MoveWindow,
SizeWindow,
FrontWindow,BringToFront,SendBehind,
HiliteWindow,
DrawGrowIcon,
BeginUpdate,EndUpdate,
InvalRect,InvalRgn,ValidRect,ValidRgn,
SetWindowPic,GetWindowPic,
FindWindow,
SelectWindow,
DragWindow,GrowWindow,TrackGoAway,
GetWMgrPort;
CONST
(* Types of Windows *)
dialogKind = 2;
userKind = 8;
(* Window definition procedure IDs *)
documentProc = 0;
dBoxProc = 1;
plainDBox = 2;
altDBoxProc = 3;
noGrowDocProc = 4;
rDocProc = 16;
(* FindWindow result codes *)
inDesk = 0;
inMenuBar = 1;
inSysWindow = 2;
inContent = 3;
inDrag = 4;
inGrow = 5;
inGoAway = 6;
(* Axis constraints for DragGrayRgn call *)
noConstraint = 0;
hAxsOnly = 1;
vAxsOnly = 2;
(* Window Messages *)
wDraw = 0;
wHit = 1;
wCalcRgns = 2;
wNew = 3;
wDispose = 4;
wGrow = 5;
wDrawGIcon = 6;
(* ... hit test codes *)
wNoHit = 0;
wInContent = 1;
wInDrag = 2;
wInGrow = 3;
wInGoAway = 4;
(* Resource ID of desktop pattern *)
deskPatID = 16;
TYPE
WindowPtr = GrafPtr;
WindowPeek = POINTER TO WindowRecord;
WindowRecord = RECORD
port: GrafPort; (* Graphics port for this window *)
windowKind: INTEGER; (* Window Class *)
visible: BOOLEAN;
hilited: BOOLEAN;
goAwayFlag: BOOLEAN;
spareFlag: BOOLEAN;
strucRgn: RgnHandle; (* Handle to structure region *)
contRgn: RgnHandle; (* Handle to content region *)
updateRgn: RgnHandle; (* Handle to update region *)
windowDefProc: Handle; (* Handle to Window Definition
* function
*)
dataHandle: Handle; (* Handle to definition function's
* data
*)
titleHandle: StringHandle;(*Handle to window's title *)
titleWidth: INTEGER; (* Private *)
controlList: Handle;
nextWindow: WindowPeek;
windowPic: PicHandle;
refCon: LONGINT
END;
PROCEDURE NewWindow(wStorage:ADDRESS;
VAR windowRect: Rect;
VAR title: ARRAY OF CHAR;
visible: BOOLEAN;
windowType: INTEGER;
behindWindow: WindowPtr;
hasClose: BOOLEAN;
refCon: LONGINT):WindowPtr;
PROCEDURE GetNewWindow(templateID:INTEGER;
wStorage: ADDRESS;
behindWindow: WindowPtr):WindowPtr;
PROCEDURE CloseWindow(theWindow:WindowPtr);
PROCEDURE DisposeWindow(theWindow:WindowPtr);
PROCEDURE SetWTitle(theWindow:WindowPtr;VAR newTitle:ARRAY OF CHAR);
PROCEDURE GetWTitle(theWindow:WindowPtr;VAR theTitle:ARRAY OF CHAR);
PROCEDURE SetWRefCon(theWindow:WindowPtr;newRefCon:LONGINT);
PROCEDURE GetWRefCon(theWindow:WindowPtr):LONGINT;
PROCEDURE HideWindow(theWindow:WindowPtr);
PROCEDURE ShowWindow(theWindow:WindowPtr);
PROCEDURE ShowHide(theWindow:WindowPtr;showFlag:BOOLEAN);
PROCEDURE MoveWindow(theWindow: WindowPtr;
hGlobal,vGlobal: INTEGER;
active: BOOLEAN);
PROCEDURE SizeWindow
(theWindow: WindowPtr;
newWidth,newHeight: INTEGER;
update: BOOLEAN);
PROCEDURE FrontWindow():WindowPtr;
PROCEDURE BringToFront(theWindow:WindowPtr);
PROCEDURE SendBehind(theWindow:WindowPtr;behindWindow:WindowPtr);
PROCEDURE HiliteWindow(theWindow:WindowPtr;onOrOff:BOOLEAN);
PROCEDURE DrawGrowIcon(theWindow:WindowPtr);
PROCEDURE BeginUpdate(theWindow:WindowPtr);
PROCEDURE EndUpdate(theWindow:WindowPtr);
PROCEDURE InvalRect(VAR badRect:Rect);
PROCEDURE InvalRgn(badRegion:RgnHandle);
PROCEDURE ValidRect(VAR goodRect:Rect);
PROCEDURE ValidRgn(goodRegion:RgnHandle);
PROCEDURE SetWindowPic (theWindow:WindowPtr;thePicture:PicHandle);
PROCEDURE GetWindowPic(theWindow:WindowPtr):PicHandle;
PROCEDURE FindWindow(MousePoint:Point;VAR theWindow:WindowPtr):INTEGER;
PROCEDURE SelectWindow(theWindow:WindowPtr);
PROCEDURE DragWindow
(theWindow:WindowPtr;
startPoint:Point;
LimitRect:Rect);
PROCEDURE GrowWindow
(theWindow: WindowPtr;
startPoint: Point;
sizeRect: Rect):LONGINT;
PROCEDURE TrackGoAway(wind:WindowPtr;start:Point):BOOLEAN;
PROCEDURE GetWMgrPort(VAR wMgrPort:GrafPtr);
END WindowManager.
!Funky!Stuff!
/* End of text from uiucdcsb:net.sources.mac */